using System;
using System.Collections.Generic;
using System.Text;

namespace Xeml.Document.EnvironmentalOntology
{
    public class Exclude : TypeSpecifics
    {
        public override bool Match(object value, VariableDataTypes baseType)
        {
            bool ret = false;
            switch (baseType)
            {
                case VariableDataTypes.Number:
                    {
                        try
                        {
                            decimal val = Convert.ToDecimal(value);
                            ret = this.NumberVal != val;

                        }
                        catch (Exception)
                        {
                            ret = false;
                        }
                        break;
                    }
                case VariableDataTypes.Text:
                    {
                        try
                        {
                            string val = Convert.ToString(value);
                            ret = !this.TextVal.Equals(val);

                        }
                        catch (Exception)
                        {
                            ret = false;
                        }
                        break;
                    }
                case VariableDataTypes.Date:
                    {
                        if (value is DateTime)
                        {
                            DateTime val = (DateTime)value;
                            ret = !this.DateVal.Equals(val);
                        }
                        else
                            ret = false;
                        break;
                    }
                case VariableDataTypes.Bool:
                    {
                        try
                        {
                            bool val = Convert.ToBoolean(value);
                            ret = this.BooleanVal != val;

                        }
                        catch (Exception)
                        {
                            ret = false;
                        }
                        break;
                    }
                default:
                    break;
            }
            return ret;
        }
    }
}
